#include "BLDC_speed_control.h"
uint32_t comper_number, speed_set, speed_now, time_slices,speed_return,counter;
//设置时间切片
void set_time_slices(uint32_t time_slices_in)
{
    time_slices = time_slices_in;
}
//设定速度
void set_speed(uint32_t speed_in)
{
    speed_set = speed_in;
    if (speed_set > 10)
    {
        comper_number = (time_slices / 12 / speed_set);
    }
    else
    {
//        motor_stop(); //停机
    }
}
//获取速度设定值
uint32_t get_speed_setted(void)
{
    return speed_set;
}
//获取实际速度
uint32_t get_speed_now(void)
{
    //新代码
    return speed_return;
}
//进行速度判断
void speed_control_watching(void)
{
    if (speed_set > 10)
    {
        if (counter++ > comper_number)
        {
            counter = 0;
            speed_flag_set_and_check_status();
        }
    }
}
